import sys

from PyQt5 import QtCore
from PyQt5.QtWidgets import QApplication, QWidget, QPushButton


class QuitButton(QWidget):
    def __init__(self, parent=None) -> None:
        super().__init__(parent=parent)
        self.setGeometry(500, 300, 500, 150)
        self.setWindowTitle('示例')
        quit = QPushButton('关闭', self)
        quit.setGeometry(10, 10, 80, 40)
        quit.setObjectName('quit_button')
        QtCore.QMetaObject.connectSlotsByName(self)

    def on_quit_button_clicked(self):
        self.close()


if __name__ == '__main__':
    app = QApplication(sys.argv)
    widget = QuitButton()
    widget.show()
    sys.exit(app.exec_())
